﻿
namespace Indeco.G24.Windows.Forms
{
	/// <summary>
	/// abstract NhaCungCapSanPhamDanhMuc typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class NhaCungCapSanPhamDanhMucDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<NhaCungCapSanPhamDanhMucDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.NhaCungCapSanPhamDanhMuc _currentNhaCungCapSanPhamDanhMuc = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxNhaCungCapSanPhamDanhMucDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxNhaCungCapSanPhamDanhMucErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxNhaCungCapSanPhamDanhMucBindingSource;
		
		/// <summary> 
		/// the DGV column associated with the IDDiaBan property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDDiaBanDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDNhaCungCap property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDNhaCungCapDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDSanPhamDanhMuc property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDSanPhamDanhMucDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ViTri property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxViTriDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TrangThai property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxTrangThaiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the HienThi property
		/// </summary>
		protected System.Windows.Forms.DataGridViewCheckBoxColumn uxHienThiDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemChinhSua property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemChinhSuaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the ThoiDiemCapNhat property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxThoiDiemCapNhatDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.DiaBan> _IDDiaBanList;
		
		/// <summary> 
		/// The list of selectable DiaBan
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.DiaBan> IDDiaBanList
		{
			get {return this._IDDiaBanList;}
			set 
			{
				this._IDDiaBanList = value;
				this.uxIDDiaBanDataGridViewColumn.DataSource = null;
				this.uxIDDiaBanDataGridViewColumn.DataSource = this._IDDiaBanList;
			}
		}
		
		private bool _allowNewItemInIDDiaBanList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of DiaBan
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDDiaBanList
		{
			get { return _allowNewItemInIDDiaBanList;}
			set
			{
				this._allowNewItemInIDDiaBanList = value;
				this.uxIDDiaBanDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.NhaCungCap> _IDNhaCungCapList;
		
		/// <summary> 
		/// The list of selectable NhaCungCap
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.NhaCungCap> IDNhaCungCapList
		{
			get {return this._IDNhaCungCapList;}
			set 
			{
				this._IDNhaCungCapList = value;
				this.uxIDNhaCungCapDataGridViewColumn.DataSource = null;
				this.uxIDNhaCungCapDataGridViewColumn.DataSource = this._IDNhaCungCapList;
			}
		}
		
		private bool _allowNewItemInIDNhaCungCapList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of NhaCungCap
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDNhaCungCapList
		{
			get { return _allowNewItemInIDNhaCungCapList;}
			set
			{
				this._allowNewItemInIDNhaCungCapList = value;
				this.uxIDNhaCungCapDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.SanPhamDanhMuc> _IDSanPhamDanhMucList;
		
		/// <summary> 
		/// The list of selectable SanPhamDanhMuc
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.SanPhamDanhMuc> IDSanPhamDanhMucList
		{
			get {return this._IDSanPhamDanhMucList;}
			set 
			{
				this._IDSanPhamDanhMucList = value;
				this.uxIDSanPhamDanhMucDataGridViewColumn.DataSource = null;
				this.uxIDSanPhamDanhMucDataGridViewColumn.DataSource = this._IDSanPhamDanhMucList;
			}
		}
		
		private bool _allowNewItemInIDSanPhamDanhMucList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of SanPhamDanhMuc
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDSanPhamDanhMucList
		{
			get { return _allowNewItemInIDSanPhamDanhMucList;}
			set
			{
				this._allowNewItemInIDSanPhamDanhMucList = value;
				this.uxIDSanPhamDanhMucDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.NhaCungCapSanPhamDanhMuc> _NhaCungCapSanPhamDanhMucList;
				
		/// <summary> 
		/// The list of NhaCungCapSanPhamDanhMuc to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.NhaCungCapSanPhamDanhMuc> NhaCungCapSanPhamDanhMucList
		{
			get {return this._NhaCungCapSanPhamDanhMucList;}
			set
			{
				this._NhaCungCapSanPhamDanhMucList = value;
				this.uxNhaCungCapSanPhamDanhMucBindingSource.DataSource = null;
				this.uxNhaCungCapSanPhamDanhMucBindingSource.DataSource = value;
				this.uxNhaCungCapSanPhamDanhMucDataGridView.DataSource = null;
				this.uxNhaCungCapSanPhamDanhMucDataGridView.DataSource = this.uxNhaCungCapSanPhamDanhMucBindingSource;				
				//this.uxNhaCungCapSanPhamDanhMucBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxNhaCungCapSanPhamDanhMucBindingSource_ListChanged);
				this.uxNhaCungCapSanPhamDanhMucBindingSource.CurrentItemChanged += new System.EventHandler(OnNhaCungCapSanPhamDanhMucBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnNhaCungCapSanPhamDanhMucBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentNhaCungCapSanPhamDanhMuc = uxNhaCungCapSanPhamDanhMucBindingSource.Current as Entities.NhaCungCapSanPhamDanhMuc;
			
			if (_currentNhaCungCapSanPhamDanhMuc != null)
			{
				_currentNhaCungCapSanPhamDanhMuc.Validate();
			}
			//_NhaCungCapSanPhamDanhMuc.Validate();
			OnCurrentEntityChanged();
		}

		//void uxNhaCungCapSanPhamDanhMucBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.NhaCungCapSanPhamDanhMuc"/> instance.
		/// </summary>
		public Entities.NhaCungCapSanPhamDanhMuc SelectedNhaCungCapSanPhamDanhMuc
		{
			get {return this._currentNhaCungCapSanPhamDanhMuc;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxNhaCungCapSanPhamDanhMucDataGridView.VirtualMode;}
			set
			{
				this.uxNhaCungCapSanPhamDanhMucDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxNhaCungCapSanPhamDanhMucDataGridView.AllowUserToAddRows;}
			set {this.uxNhaCungCapSanPhamDanhMucDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxNhaCungCapSanPhamDanhMucDataGridView.AllowUserToDeleteRows;}
			set {this.uxNhaCungCapSanPhamDanhMucDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxNhaCungCapSanPhamDanhMucDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxNhaCungCapSanPhamDanhMucDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="NhaCungCapSanPhamDanhMucDataGridViewBase"/> class.
		/// </summary>
		public NhaCungCapSanPhamDanhMucDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxNhaCungCapSanPhamDanhMucDataGridView = new System.Windows.Forms.DataGridView();
			this.uxNhaCungCapSanPhamDanhMucBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxNhaCungCapSanPhamDanhMucErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDiaBanDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDNhaCungCapDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxIDSanPhamDanhMucDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxViTriDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTrangThaiDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxHienThiDataGridViewColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
			this.uxThoiDiemChinhSuaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxThoiDiemCapNhatDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			//this.uxIDDiaBanBindingSource = new DiaBanBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDDiaBanBindingSource)).BeginInit();
			//this.uxIDNhaCungCapBindingSource = new NhaCungCapBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDNhaCungCapBindingSource)).BeginInit();
			//this.uxIDSanPhamDanhMucBindingSource = new SanPhamDanhMucBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDSanPhamDanhMucBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNhaCungCapSanPhamDanhMucDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNhaCungCapSanPhamDanhMucBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNhaCungCapSanPhamDanhMucErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxNhaCungCapSanPhamDanhMucErrorProvider
			// 
			this.uxNhaCungCapSanPhamDanhMucErrorProvider.ContainerControl = this;
			this.uxNhaCungCapSanPhamDanhMucErrorProvider.DataSource = this.uxNhaCungCapSanPhamDanhMucBindingSource;						
			// 
			// uxNhaCungCapSanPhamDanhMucDataGridView
			// 
			this.uxNhaCungCapSanPhamDanhMucDataGridView.AutoGenerateColumns = false;
			this.uxNhaCungCapSanPhamDanhMucDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxNhaCungCapSanPhamDanhMucDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDiaBanDataGridViewColumn,
		this.uxIDNhaCungCapDataGridViewColumn,
		this.uxIDSanPhamDanhMucDataGridViewColumn,
		this.uxViTriDataGridViewColumn,
		this.uxTrangThaiDataGridViewColumn,
		this.uxHienThiDataGridViewColumn,
		this.uxThoiDiemChinhSuaDataGridViewColumn,
		this.uxThoiDiemCapNhatDataGridViewColumn			});
			this.uxNhaCungCapSanPhamDanhMucDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxNhaCungCapSanPhamDanhMucDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxNhaCungCapSanPhamDanhMucDataGridView.Name = "uxNhaCungCapSanPhamDanhMucDataGridView";
			this.uxNhaCungCapSanPhamDanhMucDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxNhaCungCapSanPhamDanhMucDataGridView.TabIndex = 0;	
			this.uxNhaCungCapSanPhamDanhMucDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxNhaCungCapSanPhamDanhMucDataGridView.EnableHeadersVisualStyles = false;
			this.uxNhaCungCapSanPhamDanhMucDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnNhaCungCapSanPhamDanhMucDataGridViewDataError);
			this.uxNhaCungCapSanPhamDanhMucDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnNhaCungCapSanPhamDanhMucDataGridViewCellValueNeeded);
			this.uxNhaCungCapSanPhamDanhMucDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnNhaCungCapSanPhamDanhMucDataGridViewCellValuePushed);
			
			//
			// uxIDDiaBanDataGridViewColumn
			//
			this.uxIDDiaBanDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDiaBanDataGridViewColumn.DataPropertyName = "IDDiaBan";
			this.uxIDDiaBanDataGridViewColumn.HeaderText = "IDDiaBan";
			this.uxIDDiaBanDataGridViewColumn.Name = "uxIDDiaBanDataGridViewColumn";
			this.uxIDDiaBanDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDiaBanDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDiaBanDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDNhaCungCapDataGridViewColumn
			//
			this.uxIDNhaCungCapDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDNhaCungCapDataGridViewColumn.DataPropertyName = "IDNhaCungCap";
			this.uxIDNhaCungCapDataGridViewColumn.HeaderText = "IDNhaCungCap";
			this.uxIDNhaCungCapDataGridViewColumn.Name = "uxIDNhaCungCapDataGridViewColumn";
			this.uxIDNhaCungCapDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDNhaCungCapDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDNhaCungCapDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDSanPhamDanhMucDataGridViewColumn
			//
			this.uxIDSanPhamDanhMucDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDSanPhamDanhMucDataGridViewColumn.DataPropertyName = "IDSanPhamDanhMuc";
			this.uxIDSanPhamDanhMucDataGridViewColumn.HeaderText = "IDSanPhamDanhMuc";
			this.uxIDSanPhamDanhMucDataGridViewColumn.Name = "uxIDSanPhamDanhMucDataGridViewColumn";
			this.uxIDSanPhamDanhMucDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDSanPhamDanhMucDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDSanPhamDanhMucDataGridViewColumn.ReadOnly = false;		
			//
			// uxViTriDataGridViewColumn
			//
			this.uxViTriDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxViTriDataGridViewColumn.DataPropertyName = "ViTri";
			this.uxViTriDataGridViewColumn.HeaderText = "ViTri";
			this.uxViTriDataGridViewColumn.Name = "uxViTriDataGridViewColumn";
			this.uxViTriDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxViTriDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxViTriDataGridViewColumn.ReadOnly = false;		
			//
			// uxTrangThaiDataGridViewColumn
			//
			this.uxTrangThaiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTrangThaiDataGridViewColumn.DataPropertyName = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.HeaderText = "TrangThai";
			this.uxTrangThaiDataGridViewColumn.Name = "uxTrangThaiDataGridViewColumn";
			this.uxTrangThaiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTrangThaiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTrangThaiDataGridViewColumn.ReadOnly = false;		
			//
			// uxHienThiDataGridViewColumn
			//
			this.uxHienThiDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxHienThiDataGridViewColumn.DataPropertyName = "HienThi";
			this.uxHienThiDataGridViewColumn.HeaderText = "HienThi";
			this.uxHienThiDataGridViewColumn.Name = "uxHienThiDataGridViewColumn";
			this.uxHienThiDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxHienThiDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxHienThiDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemChinhSuaDataGridViewColumn
			//
			this.uxThoiDiemChinhSuaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemChinhSuaDataGridViewColumn.DataPropertyName = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.HeaderText = "ThoiDiemChinhSua";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Name = "uxThoiDiemChinhSuaDataGridViewColumn";
			this.uxThoiDiemChinhSuaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemChinhSuaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemChinhSuaDataGridViewColumn.ReadOnly = false;		
			//
			// uxThoiDiemCapNhatDataGridViewColumn
			//
			this.uxThoiDiemCapNhatDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxThoiDiemCapNhatDataGridViewColumn.DataPropertyName = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.HeaderText = "ThoiDiemCapNhat";
			this.uxThoiDiemCapNhatDataGridViewColumn.Name = "uxThoiDiemCapNhatDataGridViewColumn";
			this.uxThoiDiemCapNhatDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxThoiDiemCapNhatDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxThoiDiemCapNhatDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDDiaBanDataGridViewColumn
			//				
			this.uxIDDiaBanDataGridViewColumn.DisplayMember = "IDDiaBanCha";	
			this.uxIDDiaBanDataGridViewColumn.ValueMember = "IDDiaBan";	
			this.uxIDDiaBanDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDDiaBanDataGridViewColumn.DataSource = uxIDDiaBanBindingSource;				
				
			//
			// uxIDNhaCungCapDataGridViewColumn
			//				
			this.uxIDNhaCungCapDataGridViewColumn.DisplayMember = "NhaCungCap";	
			this.uxIDNhaCungCapDataGridViewColumn.ValueMember = "IDNhaCungCap";	
			this.uxIDNhaCungCapDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDNhaCungCapDataGridViewColumn.DataSource = uxIDNhaCungCapBindingSource;				
				
			//
			// uxIDSanPhamDanhMucDataGridViewColumn
			//				
			this.uxIDSanPhamDanhMucDataGridViewColumn.DisplayMember = "IDSanPhamDanhMucCha";	
			this.uxIDSanPhamDanhMucDataGridViewColumn.ValueMember = "IDSanPhamDanhMuc";	
			this.uxIDSanPhamDanhMucDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDSanPhamDanhMucDataGridViewColumn.DataSource = uxIDSanPhamDanhMucBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxNhaCungCapSanPhamDanhMucDataGridView);
			this.Name = "NhaCungCapSanPhamDanhMucDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDDiaBanBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDNhaCungCapBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDSanPhamDanhMucBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNhaCungCapSanPhamDanhMucErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNhaCungCapSanPhamDanhMucDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxNhaCungCapSanPhamDanhMucBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				NhaCungCapSanPhamDanhMucDataGridViewEventArgs args = new NhaCungCapSanPhamDanhMucDataGridViewEventArgs();
				args.NhaCungCapSanPhamDanhMuc = _currentNhaCungCapSanPhamDanhMuc;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class NhaCungCapSanPhamDanhMucDataGridViewEventArgs : System.EventArgs
		{
			private Entities.NhaCungCapSanPhamDanhMuc	_NhaCungCapSanPhamDanhMuc;
	
			/// <summary>
			/// the  Entities.NhaCungCapSanPhamDanhMuc instance.
			/// </summary>
			public Entities.NhaCungCapSanPhamDanhMuc NhaCungCapSanPhamDanhMuc
			{
				get { return _NhaCungCapSanPhamDanhMuc; }
				set { _NhaCungCapSanPhamDanhMuc = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxNhaCungCapSanPhamDanhMucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnNhaCungCapSanPhamDanhMucDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxNhaCungCapSanPhamDanhMucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnNhaCungCapSanPhamDanhMucDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxNhaCungCapSanPhamDanhMucDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDiaBanDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].IDDiaBan;
						break;
					case "uxIDNhaCungCapDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].IDNhaCungCap;
						break;
					case "uxIDSanPhamDanhMucDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].IDSanPhamDanhMuc;
						break;
					case "uxViTriDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].ViTri;
						break;
					case "uxTrangThaiDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].TrangThai;
						break;
					case "uxHienThiDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].HienThi;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].ThoiDiemChinhSua;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						e.Value = NhaCungCapSanPhamDanhMucList[e.RowIndex].ThoiDiemCapNhat;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxNhaCungCapSanPhamDanhMucDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnNhaCungCapSanPhamDanhMucDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxNhaCungCapSanPhamDanhMucDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDiaBanDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].IDDiaBan = (System.Guid)e.Value;
						break;
					case "uxIDNhaCungCapDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].IDNhaCungCap = (System.Guid)e.Value;
						break;
					case "uxIDSanPhamDanhMucDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].IDSanPhamDanhMuc = (System.Guid)e.Value;
						break;
					case "uxViTriDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].ViTri = (System.Int32)e.Value;
						break;
					case "uxTrangThaiDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].TrangThai = (System.Boolean)e.Value;
						break;
					case "uxHienThiDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].HienThi = (System.Boolean)e.Value;
						break;
					case "uxThoiDiemChinhSuaDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].ThoiDiemChinhSua = (System.DateTime)e.Value;
						break;
					case "uxThoiDiemCapNhatDataGridViewColumn":
						NhaCungCapSanPhamDanhMucList[e.RowIndex].ThoiDiemCapNhat = (System.DateTime)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
